from pygame import *

a = 1
b = 1
init() # 初始化包
cl = time.Clock() # 定义游戏时钟

screen_x = 1536
screen_y = 864

screen = display.set_mode((screen_x, screen_y)) # 定义游戏界面对象

bg = image.load("./source/bg.jpeg") # 背景
player = image.load("./source/player.png")

player_x, player_y = 0, 0

# 游戏循环
while True:
    cl.tick(300)
    screen.blit(bg, (-150,-150))
    screen.blit(player, (player_x, player_y))
    display.update()
    
    if player_y > screen_y-224:
        a *= -1
    if player_y < 0:
        a *= -1
    
    if player_x > screen_x-318:
        b *= -1
    if player_x < 0:
        b *= -1

    player_x += b
    player_y += a

quit()
